<template>
  <div class="good-list">
    <div class="goods">
      <div class="goods-item" v-for="item in goods" :key="item">
        <img :src="item.img" />
        <p class="goods-item-title">{{ item.title }}</p>
        <div class="goods-item-bottom">
          <small>￥</small>
          <span class="goods-item-price">{{ item.price }}</span>
          <span class="postage">包邮</span>
          <span class="goods-item-sellcount">销量{{ item.stored }}</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "GoodList",
  props: {
    goods: {
      type: Array,
      default() {
        return []
      }
    }
  }
};
</script>

<style scoped>
.goods {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  padding: 0 1%;
}

.goods-item {
  width: 48%;
  border-radius: 10px;
  overflow: hidden;
  margin: 5px 0px;
  box-shadow: 0px 0px 4px gainsboro;
}

.goods-item img {
  width: 100%;
}

.goods-item-title {
  padding: 0 6px;
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  text-overflow: ellipsis;
  font-size: 12px;
  line-height: 15px;
}

.goods-item-bottom {
  position: relative;
  padding: 6px 6px;
}

.goods-item small {
  font-size: 8px;
  color: var(--color-tint);
}

.goods-item-price {
  color: var(--color-high-text);
  font-weight: 500;
  font-size: 16px;
}

.goods-item .postage {
  font-size: 8px;
  color: var(--color-high-text);
  padding: 1px 2px;
  border: 1px solid var(--color-high-text);
  position: relative;
  left: 6px;
  bottom: 3px;
  border-radius: 3px;
}

.goods-item-sellcount {
  color: var(--color-high-text);
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 8px;
  background-color: #fcedef;
  position: absolute;
  right: 6px;
  bottom: 7px;
}
</style>